from django import forms
from .models import Task
import datetime 

#class NewTopicForm(forms.ModelForm):
#    message = forms.CharField(
#        widget=forms.Textarea(attrs={'rows': 5, 'placeholder': '请说出你的想法'}),
#        max_length=4000,
#        help_text='最大输入 2000 个汉字或者 4000 个字母.')
#
#    class Meta:
#        model = Topic
#        fields = ['subject', 'message']



class  TaskForm(forms.ModelForm):
    class Meta:
        model = Task
        fields = ['name','point','divide_type','exp_date' ,'descrition','picture','attachment']
        widgets = {
            'exp_date': forms.DateTimeInput()
        }
#    def __init__(self, *args, **kwargs):
#        super(TaskForm, self).__init__(*args, **kwargs)
#
#        if self.instance:
#            if self.instance.type == 'bool':
#                self.fields['data']= BooleanField()
#            if self.instance.type == 'date':
#                self.fields['data']= DateField()
#            if self.instance.type == 'float':
#                self.fields['data']= DecimalField()
#            if self.instance.type == 'text':
#                self.fields['data']= TextInput()
#            self.fields['data'].label = self.instance.name
#
